<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of DatabaseConnection
 *
 * @author Developer
 */
class DatabaseConnection {

    private $user;
    private $password;
    private $host;
    private $database;
    
    function __construct() {
        $this->connect();
    }

 
    function getConnectionDetails(){
        
        require 'conf/database.php';
        
        $this->database = DBDB;
        $this->host = DBHOST;
        $this->password = DBPASS;
        $this->user = DBUER;
        
    }
            
    function connect(){
        
        $this->getConnectionDetails();
        
        mysql_connect($this->host, $this->user, $this->password) ? : die('Unable to connect to database'. mysql_error());
        $mysql_select_db = mysql_select_db($this->database);
        if ($mysql_select_db) {
            echo 'We are in!';
        }
    }
    
}

?>
